import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 17655
 * Date: 2025-07-07
 * Time: 21:57
 */
public class test1 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextInt()) { // 注意 while 处理多个 case
            int L = in.nextInt();
            int R = in.nextInt();
            int count = 0;
            for(int i=L;i<=R;i++){
                int tmp = i;
                while(tmp!=0){
                    int n = tmp%10;
                    tmp /=10;
                    if(n==2){
                        count++;
                    }
                }
            }
            System.out.println(count);
        }
    }
}
